package com.example.qixin0314.Nat;

import android.app.Application;

import cn.leancloud.LCLogger;
import cn.leancloud.LeanCloud;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class BaseApplication extends Application {
    public static HttpbinService httpbinService;

    @Override
    public void onCreate()
    {
        super.onCreate();

        // 在 LeanCloud.initialize() 之前调用
        LeanCloud.setLogLevel(LCLogger.Level.DEBUG);

        LeanCloud.initialize("HCJDor8HfA1q0YfKq0XkLTrx-gzGzoHsz",
                "g2vhCTq3iYpn2y0pQJz9yLVi","https://hcjdor8h.lc-cn-n1-shared.com");


        Retrofit retrofit =
                new Retrofit.Builder()
                        //URL主机地址
                        .baseUrl("http://api.qxswt.com")
                        //添加解析插件
                        .addConverterFactory(GsonConverterFactory.create())
                        //添加RxJava请求框架
                        .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                        .build();

        createRequest(retrofit);


    }
    private void createRequest(Retrofit retrofit)
    {
        httpbinService = retrofit.create(HttpbinService.class);
    }
}

